package com.wwtech.epp.data.api;


import com.wwtech.epp.entity.AllNode;
import com.wwtech.epp.entity.Approve;
import com.wwtech.epp.entity.ApproveState;
import com.wwtech.epp.entity.BaseBack;
import com.wwtech.epp.entity.Comment;
import com.wwtech.epp.entity.CreateGroup;
import com.wwtech.epp.entity.Daily;
import com.wwtech.epp.entity.Freinds;
import com.wwtech.epp.entity.GroupInfo;
import com.wwtech.epp.entity.GroupMemberme;
import com.wwtech.epp.entity.Groupme;
import com.wwtech.epp.entity.LoadFile;
import com.wwtech.epp.entity.NodeInfo;
import com.wwtech.epp.entity.NodeMember;
import com.wwtech.epp.entity.Notice;
import com.wwtech.epp.entity.ProjectDetail;
import com.wwtech.epp.entity.ProjectEntity;
import com.wwtech.epp.entity.SignConfig;
import com.wwtech.epp.entity.TaskList;
import com.wwtech.epp.entity.TodaySign;
import com.wwtech.epp.entity.Token;
import com.wwtech.epp.entity.UserInfo;
import com.wwtech.epp.entity.UserLogin;
import com.wwtech.epp.entity.WorkCategory;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.PATCH;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

import static com.wwtech.epp.data.api.API.URL_IM_FRIENDS_OP;
import static com.wwtech.epp.data.api.API.URL_IM_GROUP;
import static com.wwtech.epp.data.api.API.URL_IM_GROUP_MEMBER;
import static com.wwtech.epp.data.api.API.URL_IM_NODEID_NODE;
import static com.wwtech.epp.data.api.API.URL_IM_RELATION;
import static com.wwtech.epp.data.api.API.URL_IM_TOKEN;
import static com.wwtech.epp.data.api.API.URL_NODE_ALL;
import static com.wwtech.epp.data.api.API.URL_NODE_PARRENTID;
import static com.wwtech.epp.data.api.API.URL_PROJECT;
import static com.wwtech.epp.data.api.API.URL_PROJECT_ADD;
import static com.wwtech.epp.data.api.API.URL_PROJECT_ADD_STAR;
import static com.wwtech.epp.data.api.API.URL_PROJECT_OWN;
import static com.wwtech.epp.data.api.API.URL_PROJECT_PARTICIPANTS;
import static com.wwtech.epp.data.api.API.URL_PROJECT_STAR;
import static com.wwtech.epp.data.api.API.URL_SIGN_CONFIG;
import static com.wwtech.epp.data.api.API.URL_SIGN_UID;
import static com.wwtech.epp.data.api.API.URL_SIGN_UID_LIST;
import static com.wwtech.epp.data.api.API.URL_SIGN_UPDATE;
import static com.wwtech.epp.data.api.API.URL_USER_INFO;
import static com.wwtech.epp.data.api.API.URL_USER_LOGIN;
import static com.wwtech.epp.data.api.API.URL_USER_UPDATE;
import static com.wwtech.epp.data.api.API.URL_WORK_APPDATA;
import static com.wwtech.epp.data.api.API.URL_WORK_APPDATA_GET;
import static com.wwtech.epp.data.api.API.URL_WORK_CATEGORY;
import static com.wwtech.epp.data.api.API.URL_WORK_MYREQUESTS;
import static com.wwtech.epp.data.api.API.URL_WORK_REMINDMEREVIEW;
import static com.wwtech.epp.data.api.API.URL_WORK_REVIEW;
import static com.wwtech.epp.data.api.API.URL_WORK_UID_REVIEW;
import static com.wwtech.epp.data.api.API.URL_WORK_UID_REVIEW_history;
import static com.wwtech.epp.data.api.API.url_changePsw;
import static com.wwtech.epp.data.api.API.url_create_group;
import static com.wwtech.epp.data.api.API.url_get_group_info;
import static com.wwtech.epp.data.api.API.url_group_quit;
import static com.wwtech.epp.data.api.API.url_im_node_info;
import static com.wwtech.epp.data.api.API.url_job_accept;
import static com.wwtech.epp.data.api.API.url_job_add;
import static com.wwtech.epp.data.api.API.url_job_creat;
import static com.wwtech.epp.data.api.API.url_job_done;
import static com.wwtech.epp.data.api.API.url_job_own;
import static com.wwtech.epp.data.api.API.url_modify_group;
import static com.wwtech.epp.data.api.API.url_notice;
import static com.wwtech.epp.data.api.API.url_opreate_group_memnber;
import static com.wwtech.epp.data.api.API.url_project_comment;
import static com.wwtech.epp.data.api.API.url_project_comment_delet;
import static com.wwtech.epp.data.api.API.url_project_comment_op;
import static com.wwtech.epp.data.api.API.url_project_delet;
import static com.wwtech.epp.data.api.API.url_project_done;
import static com.wwtech.epp.data.api.API.url_project_hurry;
import static com.wwtech.epp.data.api.API.url_project_report;
import static com.wwtech.epp.data.api.API.url_update_work_state;
import static com.wwtech.epp.data.api.API.url_work_attachment;
import static com.wwtech.epp.data.api.API.url_work_get_report;
import static com.wwtech.epp.data.api.API.url_work_recive_report;
import static com.wwtech.epp.data.api.API.url_work_review;
import static com.wwtech.epp.data.api.API.url_work_review_op;

/**
 * Created by hu on 2017/5/16.
 */

public interface HttpApi {

//    @FormUrlEncoded
//    @POST("wygl_xungeng_app/plan/time")
//    Observable<XunGengXiangQing> getOneDayXunJianPlans(@FieldMap Map<String, String> params);


    //***************************************user******************************//
    @GET(URL_USER_LOGIN)
    Observable<UserLogin> userLogin(@QueryMap Map<String, String> params);
    @POST(url_changePsw)
    @FormUrlEncoded
    Observable<BaseBack> changePwd(@FieldMap Map<String, String> params);
    //***************************************user******************************//


    //***************************************im******************************//
    @GET(URL_IM_TOKEN)
    Observable<Token> getImToken(@QueryMap Map<String, String> params);

    @GET(URL_IM_RELATION)
    Observable<Freinds> getFriends(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_IM_GROUP)
    Observable<Groupme> getGroup(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_IM_GROUP_MEMBER)
    Observable<GroupMemberme> getGroupMember(@Path("groupId") String groupId, @QueryMap Map<String, String> params);
    @GET(URL_IM_NODEID_NODE)
    Observable<NodeMember> getNodeMember(@Path("nodeId") String groupId, @QueryMap Map<String, String> params);
    @GET(url_im_node_info)
    Observable<NodeInfo> getNodeInfo(@Path("nodeId") String groupId, @QueryMap Map<String, String> params);

    @GET(url_notice)
    Observable<Notice> getNotice(@Path("uid") String groupId, @QueryMap Map<String, String> params);

    @GET(url_get_group_info)
    Observable<GroupInfo> getGroupInfo(@Path("groupId") String groupId, @QueryMap Map<String, String> params);

    @Multipart
    @POST(url_create_group)
    Observable<CreateGroup> createGroup(@PartMap Map<String, RequestBody> params);
    @Multipart
    @POST(url_modify_group)
    Observable<BaseBack> modifyGroup(@PartMap Map<String, RequestBody> params);

    @DELETE(url_opreate_group_memnber)
    Observable<BaseBack> deleteGroupMember(@Path("groupId") String groupId, @QueryMap Map<String, String> params);

    @POST(url_group_quit)
    @FormUrlEncoded
    Observable<BaseBack> quitGroup(@FieldMap Map<String, String> params);

    @PATCH(url_opreate_group_memnber)
    Observable<BaseBack> addGroupMember(@Path("groupId") String groupId, @QueryMap Map<String, String> params);

    @FormUrlEncoded
    @POST(URL_IM_FRIENDS_OP)
    Observable<BaseBack> OpFreind(@FieldMap Map<String, String> params);
    //***************************************im******************************//

    //***************************************org******************************//
    @GET(URL_NODE_ALL)
    Observable<AllNode> getAllNode(@QueryMap Map<String, String> params);

    @GET(URL_NODE_PARRENTID)
    Observable<BaseBack> getNodeByParent(@Path("parrentId") String uid, @QueryMap Map<String, String> params);
    //***************************************org******************************//


    //***************************************work******************************//
    @GET(URL_WORK_CATEGORY)
    Observable<WorkCategory> getWorkCategory(@QueryMap Map<String, String> params);


    @GET(URL_WORK_REVIEW)
    Observable<ApproveState> getApproveInfo(@Path("requestId") String requestId, @QueryMap Map<String, String> params);
    @GET(URL_WORK_MYREQUESTS)
    Observable<Approve> getApproveMyRequest(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_WORK_REMINDMEREVIEW)
    Observable<Approve> getApproveRemindMeReview(@Path("uid") String uid,@QueryMap Map<String, String> params);
    @GET(URL_WORK_UID_REVIEW)
    Observable<Approve> getApproveReview(@Path("uid") String uid,@QueryMap Map<String, String> params);
    @GET(URL_WORK_UID_REVIEW_history)
    Observable<Approve> getApproveReviewHistory(@Path("uid") String uid,@QueryMap Map<String, String> params);

    @GET(url_work_recive_report)
    Observable<Daily> getReceiveReport(@Path("userId") String uid, @QueryMap Map<String, String> params);

    @GET(url_work_get_report)
    Observable<Daily> getMyReport(@Path("userId") String uid,@QueryMap Map<String, String> params);

    @DELETE(url_work_review)
    Observable<BaseBack> removeApprove(@QueryMap Map<String, String> params);
    @POST(url_work_review_op)
    @FormUrlEncoded
    Observable<BaseBack> operateApprove(@FieldMap Map<String, String> params);
    @GET(URL_WORK_APPDATA_GET)
    Observable<BaseBack> getUIDesc(@Path("dataId") String uid,@QueryMap Map<String, String> params);
    @FormUrlEncoded
    @POST(URL_WORK_APPDATA)
    Observable<BaseBack> upLoadAppData(@FieldMap Map<String, String> params);
    //***************************************work******************************//


    //***************************************sign******************************//
    @GET(URL_SIGN_CONFIG)
    Observable<SignConfig> getSignConfig(@QueryMap Map<String, String> params);
    @FormUrlEncoded
    @POST(URL_SIGN_UPDATE)
    Observable<BaseBack> updateSign(@FieldMap Map<String, String> params);
    @GET(URL_SIGN_UID)
    Observable<TodaySign> getSign(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_SIGN_UID_LIST)
    Observable<Approve> getSignList(@Path("uid") String uid, @QueryMap Map<String, String> params);
    //***************************************sign******************************//


    //***************************************job******************************//

    //***************************************job******************************//
    @FormUrlEncoded
    @POST(url_job_add)
    Observable<BaseBack> jobAdd(@FieldMap Map<String, String> params);

    @GET(url_job_own)
    Observable<TaskList> jobOwner(@Path("uid") String uid, @QueryMap Map<String, String> params);

    @GET(url_job_creat)
    Observable<TaskList> jobCreat(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(url_job_accept)
    Observable<BaseBack> jobAccept(@QueryMap Map<String, String> params);
    @GET(url_job_done)
    Observable<BaseBack> jobFinish(@QueryMap Map<String, String> params);
    //***************************************user******************************//
    @GET(URL_USER_INFO)
    Observable<UserInfo> getUserInfo(@Path("uid") String uid);

    @PATCH(url_update_work_state)
    Observable<BaseBack> updateWorkState(@Path("uid") String uid, @QueryMap Map<String, String> params);

    /**
     * 这个接口比较复杂，还有一个新建项目的也比较复杂
     * @Part("userId") String userId, @Part("nickName") String nickName
     * @param uid
     * @return
     */
    @POST(URL_USER_UPDATE)
    @Multipart
    Observable<UserInfo> setMyInfo(@Path("uid") String uid, @PartMap Map<String, RequestBody> map);


    @POST(URL_USER_UPDATE)
    @Multipart
//    Observable<UserInfo> setMyInfo(@Path("uid") String uid, @Part("userId") RequestBody userId, @Part("nickName") RequestBody nickName);
    Observable<UserInfo> setMyAvater(@Path("uid") String uid, @Part MultipartBody.Part head, @Part("userId") RequestBody userId);

    @POST(url_work_attachment)
    @Multipart
    Observable<LoadFile> uploadFile(@Part MultipartBody.Part filename);
    //***************************************project******************************//
    @POST(URL_PROJECT_ADD)
    @Headers({"Content-Type: application/json","Accept: application/json"})
    Observable<BaseBack> addProject(@Body Map<String, String> map);       //@Part MultipartBody.Part projectForm

    @GET(URL_PROJECT_OWN)
    Observable<ProjectEntity> getProjectOwn(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_PROJECT_PARTICIPANTS)
    Observable<ProjectEntity> getProjectParticipants(@Path("uid") String uid, @QueryMap Map<String, String> params);
    @GET(URL_PROJECT_STAR)
    Observable<ProjectEntity> getProjectStar(@Path("uid") String uid, @QueryMap Map<String, String> params);

    @POST(url_project_report)
    @FormUrlEncoded
    Observable<BaseBack> report(@FieldMap Map<String, String> params);
    @GET(URL_PROJECT)
    Observable<ProjectDetail> getProjectDetail(@Path("projectId") String projectId, @QueryMap Map<String, String> params);

    @GET(URL_PROJECT_ADD_STAR)
    Observable<BaseBack> addStar(@QueryMap Map<String, String> params);
    @GET(url_project_hurry)
    Observable<BaseBack> projectHurry(@QueryMap Map<String, String> params);
    @GET(url_project_done)
    Observable<BaseBack> projectDone(@QueryMap Map<String, String> params);
    @GET(url_project_comment_op)
    Observable<Comment> getProjectComment(@Path("projectId") String projectId, @QueryMap Map<String, String> params);
    @DELETE(url_project_comment_delet)
    Observable<BaseBack> deletComment(@Path("commentId") String commentId, @QueryMap Map<String, String> params);
    @DELETE(url_project_delet)
    Observable<BaseBack> deletProject(@QueryMap Map<String, String> params);
    @POST(url_project_comment)
    @FormUrlEncoded
    Observable<BaseBack> addComment(@FieldMap Map<String, String> params);

    @DELETE(URL_PROJECT_ADD_STAR)
    Observable<BaseBack> deleteStar(@QueryMap Map<String, String> params);

    //***************************************project******************************//
}
